<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>登陆 - FinalCMS Admin</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<link rel="stylesheet" href="${ctx}/css/bootstrap.min.css" />
<link rel="stylesheet" href="${ctx}/css/font-awesome.min.css" />

<link rel="stylesheet" href="${ctx}/css/fc-fonts.css" />
<link rel="stylesheet" href="${ctx}/css/fc.min.css" />

<!--[if lte IE 9]>
<link rel="stylesheet" href="${ctx}/css/fc-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="${ctx}/css/fc-rtl.min.css" />

<!--[if lte IE 9]>
  <link rel="stylesheet" href="${ctx}/css/fc-ie.min.css" />
<![endif]-->
<link rel="stylesheet" href="${ctx}/css/fc-custom.css" />

<!--[if lt IE 9]>
<script src="${ctx}/js/html5shiv.js"></script>
<script src="${ctx}/js/respond.min.js"></script>
<![endif]-->
</head>

<body class="login-layout">
<div class="main-container">
	<div class="main-content">
		<div class="row">
			<div class="col-sm-10 col-sm-offset-1">
				<div class="login-container">
					<div class="center">
						<h1>
							<i class="ace-icon fa fa-leaf green"></i>
							<span class="red">FinalCMS</span>
							<span class="white" id="id-text2">Application</span>
						</h1>
						<h4 class="blue" id="id-company-text">&copy; My Company</h4>
					</div>
					<div class="space-6"></div>

					<div class="position-relative">
						<div id="login-box" class="login-box visible widget-box no-border">
							<div class="widget-body">
								<div class="widget-main">
									<h4 id="_msg" class="header blue lighter bigger">
										<i class="ace-icon fa fa-coffee green"></i>
										<?if(isEmpty(error)){?>
										<b>请输入账号和密码</b>
										<?}else{?>
										<b class="red"> ${error!""} </b>
										<?}?>
									</h4>
									<div class="space-6"></div>

									<form id="loginForm" action="#" method="post">
										<fieldset>
											<label class="block clearfix">
												<span class="block input-icon input-icon-right">
													<input type="text" class="form-control" placeholder="账号" name="login_name" id="login_name" />
													<i class="ace-icon fa fa-user"></i>
												</span>
											</label>

											<label class="block clearfix">
												<span class="block input-icon input-icon-right">
													<input type="password" class="form-control" placeholder="密码"  name="passwd" id="passwd"/>
													<i class="ace-icon fa fa-lock"></i>
												</span>
											</label>

											<span class="verify-span">
												<img alt="验证码" src="${ctx}/captcha" class="verify-img" id="verify-img">
												<span class="glyphicon glyphicon-ok" id="verify-icon"></span>
											</span>
											<label class="block clearfix verify-code-label">
												<span class="block input-icon input-icon-right">
													<input type="text" maxlength="6" id="verify-code-input" name="vcode" class="form-control verify-code-input" placeholder="验证码" autocomplete="off"/>
													<i class="ace-icon fa fa-arrow-left"></i>
												</span>
											</label>
											
											<div class="space"></div>

											<div class="clearfix">
												<!-- <label class="inline">
													<input type="checkbox" class="ace" id="rememberme" name="rememberme" />
													<span class="lbl"> Rememberme</span>
												</label> -->
												<button type="button" id="loginBtn" class="width-35 pull-right btn btn-sm btn-primary">
													<i class="ace-icon fa fa-key"></i>
													<span class="bigger-110" id="subBtn">登陆</span>
												</button>
											</div>
											<div class="space-4"></div>
										</fieldset>
									</form>

									<div class="social-or-login center">
										<span class="bigger-110">Or</span>
									</div>

									<div class="space-2"></div>
								</div><!-- /.widget-main -->
								<div class="toolbar clearfix">
										<div>
											<a href="#" data-target="#forgot-box" class="forgot-password-link">
												<i class="ace-icon fa fa-arrow-left"></i>
												忘记密码?
											</a>
										</div>

										<div>
											<a href="${ctx}/admin/account/regist" data-target="#signup-box" class="user-signup-link">
												注册
												<i class="ace-icon fa fa-arrow-right"></i>
											</a>
										</div>
									</div>
							</div><!-- /.widget-main -->
						</div><!-- /.widget-body -->
					</div><!-- /.login-box -->
				</div><!-- /.position-relative -->
			</div>
		</div><!-- /.row -->
	</div><!-- /.main-content -->
</div><!-- /.main-container -->

<script type="text/javascript" src='${ctx}/js/jquery1.11.0.min.js'></script>
<script type="text/javascript" src="${ctx}/js/jquery.cookie.js"></script>
<script type="text/javascript" src="${ctx}/js/crypto.js"></script>
<script type="text/javascript" src="${ctx}/js/common.js"></script>
<script type="text/javascript">
jQuery(function($) {
	$("#verify-img").click(reloadVerifyImg);
	
	$(document).keypress(function(e) {
	    // 回车键事件  
       if(e.which == 13) {  
    	   $("#loginBtn").click();
	   }
	}); 
	
	//登录
	$("#loginBtn").click(function(){
		var username = $.trim($("#login_name").val());
		var passwd = $.trim($("#passwd").val());
		var vcode = $.trim($("#verify-code-input").val());
		if(username.length == 0) {
			showErr("用户名不能为空");
			return false;
		} else if(passwd.length == 0) {
			showErr("密码不能为空");
			return false;
		} else if(vcode.length != 4) {
			showErr("验证码错误");
			return false;
		}
		$("#passwd").val(CryptoJS.MD5(passwd+"{"+username+"}"));
		$("#loginForm").attr("action", "${ctx}/admin/account/doLogin");
		$("#loginForm").submit();
	});
});
</script>
</body>
</html>